home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11332 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP!!!!  --very important!!--
  5. Date: 23 Mar 1996 00:27:51 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4j05l7$7gb@solutions.solon.com>
  8. References: <1996Mar21.000242.138161@forest> <4iv8ub$95t@spanky.pls.ov.com>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <4iv8ub$95t@spanky.pls.ov.com>,
  12. Fletcher.Glenn@ov.com <glenn@ov.com> wrote:
  13. >In article 138161@forest, groy@forest.drew.edu (I can't think of a nickname) writes:
  14. >>Please Help....
  15. >>I need to get this program working... the function set_diff is supposed to 
  16. >>find the differences between the two arrays (a[] and b[]) and put the 
  17. >>differences(if any) in array c[]....
  18.  
  19. >>int set_diff(int a[], int b[], int c[], int max) {
  20. >>  int *first = a;
  21. >>  int *second = b;
  22. >>  int *third = c;
  23.  
  24. >The above three pointers are pointers to *copies* of the input arrays.
  25.  
  26. Huh?
  27.  
  28. >None of the original arrays are affected in any way.  If that was not
  29. >your intent, then you need to reformulate your input list to be
  30. >pointers to the arrays, and to adjust your function code accordingly.
  31.  
  32. This is utterly incorrect.  When you declare a function argument as
  33. an array, it silently converts into a pointer.
  34.  
  35. You could easily test this, or verify it by reading the standard.
  36.  
  37. -s
  38. -- 
  39. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  40. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  41. FUCK the communications decency act.  Goddamned government.  [literally.]
  42. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  43.